import { Rule, RuleType } from "@midwayjs/validate";
import { PageDTO } from "@dto/common/page.dto";

// 查询参数
export class ListPostDTO extends PageDTO {
  @Rule(RuleType.string())
  postCode?: string;

  @Rule(RuleType.string())
  postName?: string;

  @Rule(RuleType.string())
  status?: string;
}

// 新增参数
export class CreatePostDTO {
  @Rule(RuleType.string().required())
  postCode: string;

  @Rule(RuleType.string().required())
  postName: string;

  @Rule(RuleType.number().required().min(0))
  postSort: number;

  @Rule(RuleType.string())
  status?: string;

  @Rule(RuleType.string().max(500).allow(null, ""))
  remark: string;
}

// 修改参数
export class UpdatePostDTO extends CreatePostDTO{
  @Rule(RuleType.number().required())
  postId: number;
}
